package net.towee.server.persistence;

import net.towee.model.discussion.Discussion;
import net.towee.model.discussion.DiscussionSubject;
import net.towee.model.discussion.Message;

/**
 * Interface of discussion store
 * 
 * @author c58
 */
public interface DiscussionStore {
	/**
	 * Return discussion with given ID
	 * 
	 * @param discId
	 * @param fields TODO
	 * @return
	 */
	Discussion getDiscussion(String id, DiscussionSubject subject, String... fields);
	
	/**
	 * Return discussion with messages shift on offset and limit by given
	 * number.
	 * 
	 * @param discId
	 * @param offset
	 * @param limit
	 * @return
	 */
	Discussion getDiscussion(String discId, DiscussionSubject subject, int offset, int limit);

	/**
	 * Add the message to discussion
	 * 
	 * @param id
	 * @param mess
	 * @return
	 */
	boolean addMessage(String discId, DiscussionSubject subject, Message mess);

	/**
	 * Remove message with some id in discussion with given id
	 * 
	 * @param discId
	 * @param messId
	 * @return
	 */
	boolean removeMessage(String discId, DiscussionSubject subject, String messId);

	/**
	 * Change message text
	 * 
	 * @param discId
	 * @param mess
	 * @return
	 */
	boolean changeMessage(String discId, DiscussionSubject subject, Message mess);
}
